<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('申请列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>岗位ID：</label>
                            <input type="text" name="postId"/>
                        </li>
                        <li>
                            <label>时间：</label>
                            <input type="text" class="time-input" placeholder="请选择时间" name="freeTime"/>
                        </li>
                        <li hidden>
                            <label>状态：</label>
                            <select name="status" th:with="type=${@dict.getType('wst_apply_status')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('wstudy:apply:edit')}]];
    var removeFlag = [[${@permission.hasPermi('wstudy:apply:remove')}]];
    var statusDatas = [[${@dict.getType('wst_apply_status')}]];
    var prefix = ctx + "wstudy/apply";
    var prefixStu = ctx + "wstudy/student";

    $(function() {
        var options = {
            url: prefix + "/list/teacher",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "申请",
            columns: [{
                checkbox: true
            },
                {
                    field: 'applyId',
                    title: 'ID',
                    visible: false
                },
                {
                    field: 'postId',
                    title: '岗位ID'
                },
                {
                    field: 'post.postName',
                    title: '岗位名称'
                },
                {
                    field: 'studentId',
                    title: '学生ID',
                },
                {
                    field: 'student.userName',
                    title: '申请人',
                },
                {
                    field: 'freeId',
                    title: '时间ID',
                    visible: false
                },
                {
                    field: 'experience',
                    title: '经验'
                },
                {
                    field: 'evaluate',
                    title: '自我评价'
                },
                {
                    field: 'status',
                    title: '状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(statusDatas, value);
                    }
                },
                {
                    field: 'createUserId',
                    title: '创建者ID',
                    visible: false
                },
                {
                    field: 'remark',
                    title: '备注'
                },
                {
                    field: 'applyStatus',
                    title: '状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(statusDatas, value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="details(\'' + row.studentId + '\')"><i class="fa fa-search"></i>申请人信息</a> ');
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="examinePage(\'' + row.applyId + '\')"><i class="fa fa-edit"></i>办理</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
    function details(studentId) {
        $.modal.openTab("详情",prefixStu+"/details/"+studentId);
    }
    function examinePage(applyId) {
        $.modal.openTab("审核",prefix+"/examinePage/"+applyId);
    }
</script>
</body>
</html>